/*
2021-7-13
https://www.acwing.com/problem/content/1154/
*/
#include<iostream>
#include<algorithm>

using namespace std;
typedef unsigned long long ull;

string f(int n,ull k)
{
    if(!n) return "";
    
    if(k<(1ull<<n-1)) return "0"+f(n-1,k);
    else
    {
        ull t=(1ull<<n)-1;
        if(n==64) t=-1;
        return "1"+f(n-1,t-k);
    }
}

int main()
{
    int n;
    ull k;
    cin>>n>>k;
    cout<<f(n,k)<<endl;
    
    return 0;
}
